using System;
using System.Collections.Generic;

namespace ContinualFlame.Locus
{	
	public class SessionManager
	{
		static SessionManager s_instance = new SessionManager();		
		public static SessionManager Instance { get { return s_instance; } }
		
		public Dictionary<string,Session> _sessions = new Dictionary<string, Session>();
		
		private SessionManager() { }
		
		public Session CreateSession()
		{
			string id = Guid.NewGuid().ToString();
			string gk = Guid.NewGuid().ToString();
			string pk = Guid.NewGuid().ToString();
			
			Session s = new Session(id, pk, gk);
			_sessions.Add(id, s);
			
			return s;
		}
		
		public Session GetSessionById(string id)
		{
			Session s = null;
			_sessions.TryGetValue(id, out s);
			return s;
		}
	}
}
